#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)

{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_pushButton_7_clicked()
{
    x1.Re=ui->lineEdit->text().toDouble();
    x1.Im=ui->lineEdit_2->text().toDouble();
    x2.Re=ui->lineEdit_3->text().toDouble();
    x2.Im=ui->lineEdit_4->text().toDouble();
    x3=x1+x2;
    ui->lineEdit_5->settext(QString().setNum(x3.Re));
    ui->lineEdit_6->settext(QString().setNum(x3.Im));
}


void MainWindow::on_pushButton_6_clicked()
{
    x1.Re=ui->lineEdit->text().toDouble();
    x1.Im=ui->lineEdit_2->text().toDouble();
    x2.Re=ui->lineEdit_3->text().toDouble();
    x2.Im=ui->lineEdit_4->text().toDouble();
    x3=x1-x2;
    ui->lineEdit_5->settext(QString().setNum(x3.Re));
    ui->lineEdit_6->settext(QString().setNum(x3.Im));
}

void MainWindow::on_pushButton_4_clicked()
{
    x1.Re=ui->lineEdit->text().toDouble();
    x1.Im=ui->lineEdit_2->text().toDouble();
    x2.Re=ui->lineEdit_3->text().toDouble();
    x2.Im=ui->lineEdit_4->text().toDouble();
    x3=x1*x2;
    ui->lineEdit_5->settext(QString().setNum(x3.Re));
    ui->lineEdit_6->settext(QString().setNum(x3.Im));
}

void MainWindow::on_pushButton_2_clicked()
{
    x1.Re=ui->lineEdit->text().toDouble();
    x1.Im=ui->lineEdit_2->text().toDouble();
    x2.Re=ui->lineEdit_3->text().toDouble();
    x2.Im=ui->lineEdit_4->text().toDouble();
    x3=x1*x2;
    ui->lineEdit_5->settext(QString().setNum(x3.Re));
    ui->lineEdit_6->settext(QString().setNum(x3.Im));
}
